/*
** bochs.c for Kernel in /home/icecrime/Kernel
** 
** Made by icecrime
** Login   <icecrime@epita.fr>
** 
** Started on  Wed Oct 18 15:07:07 2006 icecrime
** Last update Wed Oct 18 15:36:41 2006 icecrime
*/

#include "system.h"
#include "assert.h"
#include "ioports.h"

#define BOCHS_PORT	0xe9

void	bochs_putch(char c)
{
  outportb(c, BOCHS_PORT);
}

void	bochs_puts(const char *str)
{
  assert(str != NULL, "Argument to bochs_putstr should not be null.");
  while (*str)
    {
      bochs_putch(*str);
      str++;
    }
}

void	bochs_putnumber(const int number)
{
  int32	d;
  int32	n;

  d = 1;
  n = number;
  if (number < 0)
    {
      n *= -1;
      bochs_putch('-');
    }
  while (n / d >= 10)
    d *= 10;
  for (; d > 0; d /= 10)
    bochs_putch('0' + (n / d) % 10);
}
